package org.swim.remote.manager;

import java.util.List;

import javax.ejb.Remote;
import javax.naming.NamingException;

import net.sf.json.JSONObject;

import org.swim.remote.entities.ICollaboration;
import org.swim.remote.entities.IFeedback;
import org.swim.remote.entities.IMessage;
import org.swim.remote.exceptions.CollaborationException;
import org.swim.remote.exceptions.SwimException;
import org.swim.remote.exceptions.TokenException;

@Remote
public interface CollaborationManagerRemote extends SwimEntityManager<ICollaboration>{

	 /**
	  * {
	  * 	senderEmail: "..."
	  * 	collaboration: {
	  * 					title: "..."
	  * 					receiverId "..."
	  * 					}
	  * 	message: {
	  * 				message: "..."
	  * 			 }
	  * } 
	  * @param object
	  * @return
	 * @throws NamingException
	 * @throws SwimException 
	  */
	public abstract ICollaboration createBaseCollaboration(JSONObject object) throws NamingException, SwimException;
	 
	/**
	  * {
	  * 	token: "..."
	  * 	collaboration: {
	  * 					title: "..."
	  * 					receiverId: "..."
	  * 					senderVisibility: "..."
	  * 					}
	  * 	message: {
	  * 				message: "..."
	  * 			 }
	  * } 
	  * @param object
	  * @return
	  * @throws NamingException 
	  * @throws SwimException 
	  * @throws TokenException
	  */
	public abstract ICollaboration createCollaboration(JSONObject object) throws TokenException, SwimException, NamingException;
	
	/**
	  * {
	  * 	token: "..."
	  * 	feedback: {
	  *					collaborationId: "..."
	  *					comment: "..."
	  *					valuation: "1" or "2,3,4,5"  
	  * 			  } 
	  * @param object
	  * @return
	 * @throws TokenException 
	 * @throws NamingException 
	 * @throws SwimException 
	  */
	public abstract ICollaboration postFeedback(JSONObject object) throws TokenException, SwimException, NamingException;
	
	/**
	  * {
	  * 	token: "..."
	  * 	feedbackId: "..."
	  * } 
	  * @param object
	  * @return
	  * @throws CollaborationException 
	  * @throws TokenException  
	  */
	public abstract ICollaboration deleteFeedback(JSONObject object) throws TokenException, CollaborationException;
	
	/**
	  * {
	  * 	token: "..."
	  * 	message: {
	  * 				message: "..."
	  * 				collaborationId: "..."
	  * 			 }
	  * } 
	  * @param object
	  * @return
	  * @throws TokenException
	  * @throws SwimException 
	  * @throws NamingException 
	  */
	public abstract ICollaboration postMessage(JSONObject object) throws TokenException, SwimException, NamingException;
	
	/**
	  * {
	  * 	token: "..."
	  * 	collaborationId: "..."
	  * 	status: "..."
	  * } 
	  * @param object
	  * @return
	  * @throws TokenException 
	  * @throws CollaborationException 
	  */
	public abstract ICollaboration setStatusCollaboration(JSONObject object) throws TokenException, CollaborationException;
	
	/**
	 * {
	 * 	token: "..."
	 * }
	 * @param object
	 * @return All collaborations for token owner in order by newer update to older update
	 * @throws TokenException 
	 */
	public abstract List<ICollaboration> getMyCollaborations(JSONObject object) throws TokenException;
	
	/**
	 * {
	 * 	token: "..."
	 *  id: "..."
	 * 	status: "READ" or "HIDDEN"
	 * }
	 * @param object
	 * @return 
	 * @throws TokenException 
	 * @throws CollaborationException 
	 */
	public abstract IMessage setStatusMessageNotification(JSONObject object) throws TokenException, CollaborationException;
	
	/**
	 * {
	 * 	token: "..."
	 *  id: "..."
	 * 	status: "READ" or "HIDDEN"
	 * }
	 * @param object
	 * @return 
	 * @throws TokenException 
	 * @throws CollaborationException 
	 */
	public abstract IFeedback setStatusFeedbackNotification(JSONObject object) throws TokenException, CollaborationException;
}
